﻿@using smp.ButterflyCakes.Models
@model smp.ButterflyCakes.Models.ViewModels.Schedule.ScheduleDay

@{
    ViewBag.Title = "Butterfly Cakes";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
           
<div class="container-fluid">
    <div class="row-fluid">
        <ul class="breadcrumb">
            <li><a href="@Url.Action("index", "Home")">Home</a><span class="divider">/</span></li>
            <li><a href="@Url.Action("index", "Schedule")">Schedule</a><span class="divider">/</span></li>
            <li class="active">@Model.DisplayDate</li>
        </ul>
    </div>
    <div class="row-fluid">
        <div class="navbar">
            <div class="navbar-inner">
                <div class="container">
                    <ul class="nav">
                        <li class="active"><a class="brand" href="#">@Model.DisplayDate</a> </li>
                        <li><a id="previous" href="#">Add Enquiry</a> </li>
                        <li><a class="createorder" id="previous" href="@Url.Action("Create", "Order")">Create an Order</a> </li>
                    </ul>
                </div>
            </div>
        </div>
    </div>
    <div class="row-fluid">
        <table class="table-bordered table-hover" width="100%">
            <tr>
                <th>
                    Items
                </th>
                <th>
                    Status
                </th>
                <th>
                </th>
            </tr>
            @if (Model.Orders.Count == 0)
            {
                <tr>
                    <td colspan="2">
                        <span class="label label-info">There are no orders currently recorded for this date</span>
                    </td>
                </tr>
            }
            @if (Model.Orders.Count > 0)
            {
                foreach (var order in Model.Orders)
                {
                    <tr class="@order.StatusClassName">
                        <td>
                            <div class="pagelink" url="/order/edit/@order.Id" href="#" data-toggle="tooltip" title="Click to view or edit">
                                <div class="row-fluid">
                                    <b>@order.Title</b>
                                </div>
                                <div class="row-fluid">
                                    <div class="span4">
                                        <span>@order.ContactName</span>
                                    </div>
                                    <div class="span8">
                                        <span>@order.SummaryDescription</span>
                                    </div>
                                </div>
                            </div>
                        </td>
                        <td>
                            <div class="span4">
                                @order.Status
                            </div>
                        </td>
                        <td>
                            
                            @if (order.Status == Status.Cancelled)
                            {
                                <button class="btn disabled">
                                    Cancel</button>
                            }
                            @if (order.Status != Status.Cancelled)
                            {
                                <button class="btn btn-danger">
                                    Cancel</button>
                            }
                        </td>
                    </tr>
                }
            }
        </table>
    </div>
</div>